﻿<div bsModal #createOrEditModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="createOrEditModal"
     aria-hidden="true" [config]="{backdrop: 'static'}">
    <div class="modal-dialog">

        <div class="modal-content">

            <form *ngIf="active" #editForm="ngForm" novalidate (ngSubmit)="save()">

                <div class="modal-header">
                    <button type="button" class="close" (click)="close()" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title">
                        <span *ngIf="language.id">{{l("EditLanguage")}}: {{language.name}}</span>
                        <span *ngIf="!language.id">{{l("CreateNewLanguage")}}</span>
                    </h4>
                </div>

                <div class="modal-body">
                    
                    <div class="form-group">
                        <select #languageCombobox
                                name="languageName"
                                class="form-control"
                                [(ngModel)]="language.name"
                                [attr.data-live-search]="true"
                                jq-plugin="selectpicker"
                                required>
                            <option value="">{{emptyText}}</option>
                            <option *ngFor="let languageName of languageNames" [value]="languageName.value">{{languageName.displayText}}</option>
                        </select>
                    </div>

                    <div class="form-group">
                        <select #iconCombobox
                                name="languageIcon"
                                class="form-control"
                                [(ngModel)]="language.icon"
                                jq-plugin="selectpicker"
                                [attr.data-live-search]="true">
                            <option value="">{{emptyText}}</option>
                            <option *ngFor="let flag of flags" [value]="flag.value" [attr.data-icon]="flag.value">{{flag.displayText}}</option>
                        </select>
                    </div>
                    
                    <div class="md-checkbox-list">
                        <div class="md-checkbox">
                            <input id="EditLanguage_IsEnabled" class="md-check" type="checkbox" name="languageIsEnabled"
                                   [(ngModel)]="language.isEnabled">
                            <label for="EditLanguage_IsEnabled">
                                <span class="inc"></span>
                                <span class="check"></span>
                                <span class="box"></span>
                                {{l("IsEnabled")}}
                            </label>
                        </div>
                    </div>

                </div>

                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">{{l("Cancel")}}</button>
                    <button type="submit" class="btn btn-primary blue" [disabled]="!editForm.form.valid" [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')"><i class="fa fa-save"></i> <span>{{l("Save")}}</span></button>
                </div>

            </form>

        </div>
    </div>
</div>